const btnLogin = document.querySelector('#btn-login')
btnLogin.addEventListener('click', async function () {
    const data = serialize(document.querySelector('form'), { hash: true })
    console.log(data);
    if (data.username === '' || data.password === '') {
        tip(`用户名不能为空`)
        return
    }
    if (data.password.length < 6) {
        tip(`密码要大于6`)
        return
    }
    const res = await axios({
        url: '/login',
        method: 'post',
        data
    })
    tip(`登陆成功`)
    setTimeout(() => {
        location.href = 'index.html'
    }, 1500);

})